package cn.funeralobjects.util;

import cn.funeralobjects.cache.EnumCache;
import cn.funeralobjects.model.EnumNumberPair;

/**
 * @author FuneralObjects
 * Create date: 2020/4/15 9:36 AM
 */
public class EnumNumberUtils {

    public static <E extends Enum<E>, EN extends EnumNumberPair<E, N>, N extends Number> E of(N key, Class<EN> enumClass) {
        if (EnumCache.isRegistered(enumClass)) {
            return EnumCache.of(key, enumClass);
        }
        return EnumNumberPair.of(key, enumClass);
    }
}
